//
//  NewUserViewController.h
//  iWeighMyself
//	Abstract: controls the screen that allows the user to configure its preferences for the first time
//
//  Created by Francisco Gindre on 7/28/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import <AddressBookUI/AddressBookUI.h>
#import "KeyBoardTextFieldCell.h"
#import "IWeighMyselfAppDelegate.h"


@interface NewUserViewController : UITableViewController{
	
	//an array containing the localized section titles
	NSMutableArray *sectionList;
	//an array containing the default values to be loaded the first time
	// the user loads the application
	NSMutableArray *cellDefaultValues;
	
	//an array containing the real values found in the bundle
	NSMutableArray *cellValues; 
	
	
	//DisplayCell that has a texfield on it. This ones are loaded from a nib file.
	
	KeyBoardTextFieldCell *nameCell;
	
	
	KeyBoardTextFieldCell *emailCell;
	
	// Application delegate. Used to handle plist containing the user data
	
	IWeighMyselfAppDelegate * appDelegate;
	
    // Where to find the Default Contact cell in the view
    
    NSIndexPath *defaultContactCellIndexPath;
    
	/*
	 where default contact will be stored
	 */
	
	NSMutableDictionary *defaultContactDictionary;
	
	/*
	 string that stores weight unit
	 */
	
	NSString * weightUnit;
	
	BOOL isWeightUnitSet;
	UIBarButtonItem *saveButton;
	
	NSIndexPath *weightUnitIndexPath;
	
	NSIndexPath *nameCellIndexPath;
	NSIndexPath *emailCellIndexPath;
	
	
	
	
	
}

@property (nonatomic,retain) NSMutableArray *sectionList;
@property (nonatomic, retain) NSMutableArray *cellDefaultValues;
@property (nonatomic,retain) NSMutableArray *cellValues;
@property (nonatomic,retain) IBOutlet KeyBoardTextFieldCell *nameCell;
@property (nonatomic,retain) IBOutlet KeyBoardTextFieldCell *emailCell;
@property (nonatomic,retain) IWeighMyselfAppDelegate *appDelegate;
@property (nonatomic,retain) NSIndexPath *defaultContactCellIndexPath;
@property (nonatomic,retain) NSMutableDictionary *defaultContactDictionary;
@property (nonatomic,retain) NSString * weightUnit;
@property (nonatomic,retain) UIBarButtonItem *saveButton;
@property (nonatomic) BOOL isWeightUnitSet;
@property (nonatomic,retain) NSIndexPath *weightUnitIndexPath;
@property (nonatomic,retain) NSIndexPath *nameCellIndexPath;
@property (nonatomic,retain) NSIndexPath *emailCellIndexPath;

/*
 saves the changed values
 */

-(void) applyNewValues:(id)sender;

/*
 returns a cell containing an UITextField configured as keyboard for text (not email)
 */
- (UITableViewCell *) createEnterNameCellAtIndexPath :(NSIndexPath*)indexPath tableView:(UITableView *) tableView ;

/*
 Creates a cell containing a textfield configured with email keyboard
 */

- (UITableViewCell*)createEnterEmailCellAtIndexPath:(NSIndexPath*)indexPath tableview:(UITableView*)tableView;

/*
 Create plain standard cell with detailed accessory
 */
-(UITableViewCell*) createPlainCellWithDisclosureAccessoryAtIndexPath:(NSIndexPath*)indexPath tableView:(UITableView*)tableView;
/* 
 loads values that might have changed on other views e.g.: choose default recipient
 */

-(void) updateCellValues ;

/*
 shows the weight unit picker
 */

-(void)showWeightUnitPicker;
@end
